home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000011_icon-group-sender _Mon Jan 6 11:23:17 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 13:49:15 MST
Date: Mon, 6 Jan 1997 11:23:17 -0800
Message-Id: <199701061923.LAA16481@dfw-ix3.ix.netcom.com>
X-Sender: bobalex@popd.ix.netcom.com
X-Mailer: Windows Eudora Pro Version 2.1.2
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: robinstu@ohsu.edu, Icon Group <icon-group@cs.arizona.edu>
From: Bob Alexander <bobalex@ix.netcom.com>
Subject: Re: Another Question from the Neophyte
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1016
>But I've run into a new problem. I have found numerous options for
>scanning forward in a string, but I haven't found a good way to move
>backwards, besides first reversing a string and then scanning forward
>(which is functionally scanning backwards).
Here's a way to solve your problem without reverse scanning:
procedure main()
while line := read() do line ? {
every i := 0 | upto(' ')
write(line[i + 1:0])
}
end
Scanning in Icon is most definitely biased toward left-to-right scanning,
however the cursor (&pos) can be moved "backward" for certain problems.
E.g. the argument to move() can be negative, and tab() can take you toward
the left, too. You can also write your own scanning functions to move the
cursor backward. This might invoke the wrath of some scanning purists, but
it works for some things.
However, as shown above, sometimes there is a completely different way of
approaching a problem that appears to involve backward scanning.
-- Bob Alexander
bobalex@ix.netcom.com